package cn.weekimwee.firstlineofcodeforkotlin

import android.annotation.SuppressLint
import android.app.Application
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import org.litepal.LitePal

/**
 * Created by Wee Kim Wee on 2018/4/8.
 */
class App : Application() {
    companion object {
        @SuppressLint("StaticFieldLeak")
        lateinit var INSTANCE: Application
    }

    override fun onCreate() {
        super.onCreate()
        INSTANCE = this
        LitePal.initialize(this)
        Logger.addLogAdapter(object : AndroidLogAdapter(PrettyFormatStrategy.newBuilder().tag("FirstLineOfCode").build()) {
            override fun isLoggable(priority: Int, tag: String?): Boolean {
                return BuildConfig.DEBUG
            }
        })
    }
}